<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>供需对接服务系统--首页列表</title>
	<!--公用样式-->
	<link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/comment.css"/>
	<!--页面样式-->
	<link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/style.css"/>
	<!--Layui-->
	<link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css" media="all"/>
	<!--extended-->
	<link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/extended.css"/>
	<!--公用样式JS-->
	<script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
	<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.js" charset="utf-8"></script>
</head>
<style>
	.Right {
		width: 100%;
		overflow-y: scroll;
	}
	.supply ul li {
		cursor: pointer;
	}
</style>

<body>
<!--头部-->

<!--容器-->
<div class="container clearfix">
	<!--右侧内容-->
	<div class="Right fr" style="overflow: hidden">
		<div class="project whitebg">
			<div class="supply">
				<ul class="clearfix blue">
					<li value=""    onclick="lxclick(this)" class="focus">全部</li>
					<li value="001" onclick="lxclick(this)">监理</li>
					<li value="002" onclick="lxclick(this)">咨询</li>
					<li value="003" onclick="lxclick(this)">检测</li>
					<li value="100" onclick="lxclick(this)">其他</li>
				</ul>
				<div class="clearfix"  style="width: 65%">
					<input  id="projectName" type="text"  style="width: 54%;" AutoComplete="off"   placeholder="请输入项目名称" class="fl" />
					<#if  "${gxtype}"=="x">
					<button type="button" class="bluebg white bor0 fr ft18" style="margin-left: 12px;width: 120px;"  onclick="pushProject()">项目发布</button>
					</#if>
					<button type="button" class="bluebg white bor0 fr ft18" style="margin-left: 12px;width: 120px;" onclick="query()">搜索</button>
				</div>
			</div>
			<div class="ft14 gary">
				<span class="blue">热搜词：</span>
				<#list  listrecords as vo>
					<span onclick="hotWord(this)" class="cursor">${vo.keyword}</span>
				</#list>
			</div>
			 <table id="tableList" class="layui-hide" lay-filter="tableList"></table>
		</div>
		<!--分页-->
<#--		<div class="whitebg">
			<div class="tcdPageCode"></div>
		</div>-->
	</div>
</div>
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
<script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/tabs.js"></script>
<script type="text/javascript">
	var layer;
	var form = layui.form;
	var table = null;
	var tableIns = null;
	//注意进度条依赖 element 模块，否则无法进行正常渲染和功能性操作
	var element = "";
	layui.use('element', function () {
		element = layui.element;
	});

	//热词搜索
    function hotWord(object){
		var jsondata = {
			projectName:$(object).text()
		};
		table.reload('tableList', {where: jsondata});
	}

	function  lxclick(object){
	  var  object=	$(object);
	  $(object).parent().find("li").removeClass("focus")
	  $(object).addClass("focus");
		 query();
	}


	function query() {
		var projectName = $('#projectName').val();
		var projectType= $(".supply").find(".focus").attr("value");
		var jsondata = {
			projectName:projectName,
			projectType: projectType
		};
		table.reload('tableList', {where: jsondata});
	}
	function pushProject(){
		window.parent._showtab('cf8c85d3685a48abb23a4104ef25997c', '项目发布', '/supplier/projectPush');
	}
	layui.use('table', function () {
		table = layui.table;
		element = element;
		//方法级渲染
		tableIns = table.render({
			id: 'tableList',
			elem: '#tableList',
			url: '/supplier/projectManager/showProjectList',
			height: "auto",
			page: true,
			cols: [[
				{
					title: '序号', width: '10%', templet: function (res) {
						return res.LAY_INDEX;
					}
				},
				{field: 'supProjectId', title: 'supProjectId', width: '10%', hide:true,sort: true},
				{field: 'projectType', title: '项目类型', width: '15%', sort: true,templet: function (d) {
					var typestr=[];
					var type=d.projectType;
					if(type){
						if (type.indexOf("001")>-1) {
							typestr.push("监理");
						}
						if (type.indexOf("002")>-1) {
							typestr.push("咨询");
						}
						if (type.indexOf("003")>-1) {
							typestr.push("检测");
						}
						if (type.indexOf("100")>-1) {
							typestr.push("其他");
						}
						typestr=typestr.join(",");
					}
					return  typestr;

		        }},
				{field: 'projectName', title: '项目名称', width: '35%', sort: true,templet:function (d) {
						return '<span class="cursor" onclick="showDetail(\'' + d.supProjectId + '\',\'' + d.projectName + '\')">' + d.projectName + '</span>';
					}},
				{field: 'status', title: '项目状态', width: '20%', sort: true,templet: function (d) {
						if (d.status == "001") {
							return '<span class="pro_status" style="background-color:#2161e3;">已保存</span>';
						}
						if (d.status == "002") {
							return '<span class="pro_status" style="background-color:#2161e3;">待审核</span>';
						}
						if (d.status == "003") {
							return '<span class="pro_status" style="background-color:#2161e3;">已驳回</span>';
						}
						if (d.status == "004") {
							return '<span class="status4">已结束</span>';
						}
						if (d.status == "005") {
							return '<span class="pro_status" style="background-color:#2161e3;">已撤销</span>';
						}
						if (d.status == "006") {
							return '<span class="pro_status" style="background-color:#2161e3;">已发布</span>'
						}
					}},
				{field: 'createDate', title: '发布时间', width: '20%', sort: true}
			]],
			done: function (res, currentCount) {
				//***重点***：table渲染完成后渲染element进度条
				element.render();
				$(".layui-table-page select").css("width","80px");

			}
		});
		//监听工具条
		table.on('tool(tableList)', function (obj) {
			var data = obj.data;
			var that = $(this);
			if(obj.event === 'resetPassword') {
				parent.layer.confirm('确定重置密码？', function (index) {
					var userId=data.userId;
					layerAjax("resetPassword", {id: userId}, "", function (d) {
						if (d.flag) {
							parent.layer.close(index);
							layer.msg("操作成功", {icon: 1});
							tableIns.reload();
						} else {
							layer.msg("操作失败", {icon: 2});
						}
					})
				});
			}
		});
	});
	function showDetail(id, projectName) {
		window.parent._showtab('xm_v' + id, '查看-' +projectName, '/supplier/projectManager/projectDetail?type=v&supProjectId=' +id);
	}



</script>
</body>

</html>
